import service from '@/utils/request'

// @Tags WorkflowDef
// @Summary 创建审批流
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.WorkflowDef true "创建审批流"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
// @Router /WorkflowDef/createWorkflowDef [post]
export const createWorkflowDef = (data) => {
  return service({
    url: '/WorkflowDef/createWorkflowDef',
    method: 'post',
    data
  })
}

// @Tags WorkflowDef
// @Summary 删除审批流
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.WorkflowDef true "删除审批流"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
// @Router /WorkflowDef/deleteWorkflowDef [delete]
export const deleteWorkflowDef = (params) => {
  return service({
    url: '/WorkflowDef/deleteWorkflowDef',
    method: 'delete',
    params
  })
}

// @Tags WorkflowDef
// @Summary 批量删除审批流
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.IdsReq true "批量删除审批流"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
// @Router /WorkflowDef/deleteWorkflowDef [delete]
export const deleteWorkflowDefByIds = (params) => {
  return service({
    url: '/WorkflowDef/deleteWorkflowDefByIds',
    method: 'delete',
    params
  })
}

// @Tags WorkflowDef
// @Summary 更新审批流
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body model.WorkflowDef true "更新审批流"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
// @Router /WorkflowDef/updateWorkflowDef [put]
export const updateWorkflowDef = (data) => {
  return service({
    url: '/WorkflowDef/updateWorkflowDef',
    method: 'put',
    data
  })
}

// @Tags WorkflowDef
// @Summary 用id查询审批流
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data query model.WorkflowDef true "用id查询审批流"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
// @Router /WorkflowDef/findWorkflowDef [get]
export const findWorkflowDef = (params) => {
  return service({
    url: '/WorkflowDef/findWorkflowDef',
    method: 'get',
    params
  })
}

// @Tags WorkflowDef
// @Summary 分页获取审批流列表
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data query request.PageInfo true "分页获取审批流列表"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /WorkflowDef/getWorkflowDefList [get]
export const getWorkflowDefList = (params) => {
  return service({
    url: '/WorkflowDef/getWorkflowDefList',
    method: 'get',
    params
  })
}

// 获取待我审批、我申请的审批
export const getWorkflowDataList = (params) => {
  return service({
    url: '/WorkflowData/getWorkflowDataList',
    method: 'get',
    params
  })
}

// 通过申请
export const agreeApply = (data) => {
  return service({
    url: '/WorkflowData/approve',
    method: 'post',
    data
  })
}

// 驳回申请
export const refuseApply = (data) => {
  return service({
    url: '/WorkflowData/reject',
    method: 'post',
    data
  })
}

// 创建申请审批
export const createApplication = data => {
    return service({
    url: '/WorkflowData/createApplication',
    method: 'post',
    data
  })
}